package cn.edu.xmu.javaee.productdemoaop.mapper.generator;

import cn.edu.xmu.javaee.productdemoaop.mapper.generator.po.ProductPo;
import cn.edu.xmu.javaee.productdemoaop.mapper.generator.po.ProductPoExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ProductPoMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @Delete({
        "delete from goods_product",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @Insert({
        "insert into goods_product (`shop_id`, `goods_id`, ",
        "`category_id`, `template_id`, ",
        "`sku_sn`, `name`, `original_price`, ",
        "`weight`, `barcode`, ",
        "`unit`, `origin_place`, ",
        "`creator_id`, `creator_name`, ",
        "`modifier_id`, `modifier_name`, ",
        "`gmt_create`, `gmt_modified`, ",
        "`status`, `commission_ratio`, ",
        "`shop_logistic_id`, `free_threshold`)",
        "values (#{shopId,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, ",
        "#{categoryId,jdbcType=BIGINT}, #{templateId,jdbcType=BIGINT}, ",
        "#{skuSn,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{originalPrice,jdbcType=BIGINT}, ",
        "#{weight,jdbcType=BIGINT}, #{barcode,jdbcType=VARCHAR}, ",
        "#{unit,jdbcType=VARCHAR}, #{originPlace,jdbcType=VARCHAR}, ",
        "#{creatorId,jdbcType=BIGINT}, #{creatorName,jdbcType=VARCHAR}, ",
        "#{modifierId,jdbcType=BIGINT}, #{modifierName,jdbcType=VARCHAR}, ",
        "#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, ",
        "#{status,jdbcType=TINYINT}, #{commissionRatio,jdbcType=INTEGER}, ",
        "#{shopLogisticId,jdbcType=BIGINT}, #{freeThreshold,jdbcType=BIGINT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(ProductPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @InsertProvider(type=ProductPoSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(ProductPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @SelectProvider(type=ProductPoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="shop_id", property="shopId", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT),
        @Result(column="category_id", property="categoryId", jdbcType=JdbcType.BIGINT),
        @Result(column="template_id", property="templateId", jdbcType=JdbcType.BIGINT),
        @Result(column="sku_sn", property="skuSn", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="original_price", property="originalPrice", jdbcType=JdbcType.BIGINT),
        @Result(column="weight", property="weight", jdbcType=JdbcType.BIGINT),
        @Result(column="barcode", property="barcode", jdbcType=JdbcType.VARCHAR),
        @Result(column="unit", property="unit", jdbcType=JdbcType.VARCHAR),
        @Result(column="origin_place", property="originPlace", jdbcType=JdbcType.VARCHAR),
        @Result(column="creator_id", property="creatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="creator_name", property="creatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="modifier_id", property="modifierId", jdbcType=JdbcType.BIGINT),
        @Result(column="modifier_name", property="modifierName", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
        @Result(column="commission_ratio", property="commissionRatio", jdbcType=JdbcType.INTEGER),
        @Result(column="shop_logistic_id", property="shopLogisticId", jdbcType=JdbcType.BIGINT),
        @Result(column="free_threshold", property="freeThreshold", jdbcType=JdbcType.BIGINT)
    })
    List<ProductPo> selectByExample(ProductPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "`id`, `shop_id`, `goods_id`, `category_id`, `template_id`, `sku_sn`, `name`, ",
        "`original_price`, `weight`, `barcode`, `unit`, `origin_place`, `creator_id`, ",
        "`creator_name`, `modifier_id`, `modifier_name`, `gmt_create`, `gmt_modified`, ",
        "`status`, `commission_ratio`, `shop_logistic_id`, `free_threshold`",
        "from goods_product",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="shop_id", property="shopId", jdbcType=JdbcType.BIGINT),
        @Result(column="goods_id", property="goodsId", jdbcType=JdbcType.BIGINT),
        @Result(column="category_id", property="categoryId", jdbcType=JdbcType.BIGINT),
        @Result(column="template_id", property="templateId", jdbcType=JdbcType.BIGINT),
        @Result(column="sku_sn", property="skuSn", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="original_price", property="originalPrice", jdbcType=JdbcType.BIGINT),
        @Result(column="weight", property="weight", jdbcType=JdbcType.BIGINT),
        @Result(column="barcode", property="barcode", jdbcType=JdbcType.VARCHAR),
        @Result(column="unit", property="unit", jdbcType=JdbcType.VARCHAR),
        @Result(column="origin_place", property="originPlace", jdbcType=JdbcType.VARCHAR),
        @Result(column="creator_id", property="creatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="creator_name", property="creatorName", jdbcType=JdbcType.VARCHAR),
        @Result(column="modifier_id", property="modifierId", jdbcType=JdbcType.BIGINT),
        @Result(column="modifier_name", property="modifierName", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_create", property="gmtCreate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT),
        @Result(column="commission_ratio", property="commissionRatio", jdbcType=JdbcType.INTEGER),
        @Result(column="shop_logistic_id", property="shopLogisticId", jdbcType=JdbcType.BIGINT),
        @Result(column="free_threshold", property="freeThreshold", jdbcType=JdbcType.BIGINT)
    })
    ProductPo selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @UpdateProvider(type=ProductPoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") ProductPo row, @Param("example") ProductPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @UpdateProvider(type=ProductPoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") ProductPo row, @Param("example") ProductPoExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @UpdateProvider(type=ProductPoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ProductPo row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table goods_product
     *
     * @mbg.generated
     */
    @Update({
        "update goods_product",
        "set `shop_id` = #{shopId,jdbcType=BIGINT},",
          "`goods_id` = #{goodsId,jdbcType=BIGINT},",
          "`category_id` = #{categoryId,jdbcType=BIGINT},",
          "`template_id` = #{templateId,jdbcType=BIGINT},",
          "`sku_sn` = #{skuSn,jdbcType=VARCHAR},",
          "`name` = #{name,jdbcType=VARCHAR},",
          "`original_price` = #{originalPrice,jdbcType=BIGINT},",
          "`weight` = #{weight,jdbcType=BIGINT},",
          "`barcode` = #{barcode,jdbcType=VARCHAR},",
          "`unit` = #{unit,jdbcType=VARCHAR},",
          "`origin_place` = #{originPlace,jdbcType=VARCHAR},",
          "`creator_id` = #{creatorId,jdbcType=BIGINT},",
          "`creator_name` = #{creatorName,jdbcType=VARCHAR},",
          "`modifier_id` = #{modifierId,jdbcType=BIGINT},",
          "`modifier_name` = #{modifierName,jdbcType=VARCHAR},",
          "`gmt_create` = #{gmtCreate,jdbcType=TIMESTAMP},",
          "`gmt_modified` = #{gmtModified,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=TINYINT},",
          "`commission_ratio` = #{commissionRatio,jdbcType=INTEGER},",
          "`shop_logistic_id` = #{shopLogisticId,jdbcType=BIGINT},",
          "`free_threshold` = #{freeThreshold,jdbcType=BIGINT}",
        "where `id` = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ProductPo row);
}